<?php
session_start();
require_once('path.php');
require_once(SOJ_ROOT.'/include/function/lib.php');

if ( empty($_SESSION['username']) ){
	//若用户还没有登录,则会重定向到首页
	header('Location:../index.php');
	exit ;	
}

$request['username'] = $_SESSION['username'] ;
$PEAR_log = &Log::factory('file', 'soj.log', 'soj');

try{
	$user_sign_process = new user_sign_process( db_connect() , $request );
	
	if ( $user_sign_process->do_signout() ){

		//传递给sign_success页面的信息,
		//告诉用户退出登录成功
		$_SESSION['success_message'] = "Sign out success";
		header('Location:../message_handle/success_handle.php');
		exit ;

	}else{
		$_SESSION['fail_message'] = '注销失败' ;
		header('Location:../message_handle/fail_handle.php');
		exit ;
	}

}catch(Exception $e){
	
	exception_handle( $e ) ;
}
	
